<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE>
<html>
<head>
    <title>修改资源【${resultVo.result.resourceName}】</title>

    <smLink1></smLink1>
    <smLink2>
        <link rel="stylesheet" href="<%=basePath%>js/lib/ztree/css/zTreeStyle/zTreeStyle.css">
        <link rel="stylesheet" href="<%=basePath%>css/lib/ztree/css/ztree.css">

        <style type="text/css">
            #zTree {
                height: 450px;
                border: 1px solid #D5D5D5;
                overflow-x: auto;
                overflow-y: auto;
            }
        </style>
    </smLink2>

    <smScript1></smScript1>
    <smScript2>
        <script type="text/javascript" src="<%=basePath%>js/lib/jquery/jquery-validation/jquery.validate.min.js"></script>
        <script type="text/javascript" src="<%=basePath%>js/lib/jquery/jquery-validation/localization/messages_zh.min.js"></script>
        <script type="text/javascript" src="<%=basePath%>js/lib/ztree/js/jquery.ztree.all.min.js"></script>
        <script type="text/javascript" src="<%=basePath%>js/jsp/resource/update.js"></script>
    </smScript2>
</head>

<body>
<div id="breadcrumbs" class="breadcrumbs ace-save-state">
    <ul class="breadcrumb">
        <li>
            <a href="<%=basePath%>web/resource/list.html">资源列表</a>
        </li>
        <li>
            <span>修改资源【${resultVo.result.resourceName}】</span>
        </li>
    </ul>
</div>

<div class="page-content">
    <div class="row">
        <div class="col-xs-7">
            <form id="resource_form" class="form-horizontal" role="form" method="post" action="<%=basePath%>web/resource/update.html">
                <input name="id" type="hidden" value="${resultVo.result.id}" placeholder="资源 ID">
                <input name="parentId" type="hidden" value="" placeholder="父资源 ID">

                <div class="form-group">
                    <label class="col-xs-3 control-label no-padding-right" for="resource_name">资源名称</label>

                    <div class="col-xs-9">
                        <input id="resource_name" name="resourceName" class="col-md-7" type="text" value="${resultVo.result.resourceName}" placeholder="资源名称">
                    </div>
                </div>

                <div class="space-1"></div>

                <div class="form-group">
                    <label class="col-xs-3 control-label no-padding-right" for="parent_name">父资源名称</label>

                    <div class="col-xs-9">
                        <input id="parent_name" name="parentName" class="col-md-7" type="text" value="${resultVo.result.parentName}" readonly="readonly" placeholder="父资源名称">
                    </div>
                </div>

                <div class="space-1"></div>

                <div class="form-group">
                    <label class="col-xs-3 control-label no-padding-right" for="resource_icon">资源图标</label>

                    <div class="col-xs-9">
                        <input id="resource_icon" name="resourceIcon" class="col-md-7" type="text" value="${resultVo.result.resourceIcon}" placeholder="资源图标">
                    </div>
                </div>

                <div class="space-1"></div>

                <div class="form-group">
                    <label class="col-xs-3 control-label no-padding-right" for="resource_url">资源URL</label>

                    <div class="col-xs-9">
                        <input id="resource_url" name="resourceUrl" class="col-md-7" type="text" value="${resultVo.result.resourceUrl}" placeholder="资源URL">

                        <label>
                            <i id="check_icon_loading1" class="hide ace-icon fa fa-spinner fa-spin warning-color"></i>
                            <i id="check_icon_success1" class="hide ace-icon iconfont icon-right success-color"></i>
                            <i id="check_icon_error1" class="hide ace-icon iconfont icon-error danger-color"></i>
                        </label>
                    </div>
                </div>

                <div class="space-1"></div>

                <div class="form-group">
                    <label class="col-xs-3 control-label no-padding-right" for="resource_type">资源类型</label>

                    <div class="col-xs-9">
                        <select id="resource_type" name="resourceType" class="col-md-7" disabled="disabled">
                            <option value="">请选择</option>
                            <option <c:if test="${resultVo.result.resourceType eq 1}">selected="selected"</c:if> value="1">菜单</option>
                            <option <c:if test="${resultVo.result.resourceType eq 2}">selected="selected"</c:if> value="2">按钮</option>
                            <option <c:if test="${resultVo.result.resourceType eq 3}">selected="selected"</c:if> value="3">数据</option>
                        </select>
                    </div>
                </div>

                <div class="space-1"></div>

                <div class="form-group">
                    <label class="col-xs-3 control-label no-padding-right" for="permission_code">权限代码</label>

                    <div class="col-xs-9">
                        <input id="permission_code" name="permissionCode" class="col-md-7" type="text" value="${resultVo.result.permissionCode}" placeholder="权限代码">

                        <label>
                            <i id="check_icon_loading2" class="hide ace-icon fa fa-spinner fa-spin warning-color"></i>
                            <i id="check_icon_success2" class="hide ace-icon iconfont icon-right success-color"></i>
                            <i id="check_icon_error2" class="hide ace-icon iconfont icon-error danger-color"></i>
                        </label>
                    </div>
                </div>

                <div class="space-1"></div>

                <div class="form-group">
                    <label class="col-xs-3 control-label no-padding-right">选择新的父资源</label>

                    <div class="col-xs-9">
                        <ul id="zTree" class="ztree col-md-7 text-no-break"></ul>
                    </div>
                </div>

                <div class="space-1"></div>

                <div class="clearfix form-actions">
                    <div class="col-md-offset-3 col-md-9">
                        <button name="submitBtn" class="btn btn-info" type="submit">
                            <i class="ace-icon iconfont icon-plus"></i>提交
                        </button>

                        &nbsp; &nbsp; &nbsp;

                        <button class="btn" type="reset">
                            <i class="ace-icon iconfont icon-reset"></i>重置
                        </button>
                    </div>
                </div>
            </form>
        </div>

        <div class="col-xs-5">
            <div class="col-xs-12 f-s-14 red">数据校验如下：</div>

            <div class="col-xs-12">
                <div class="alert alert-warning m-0 m-t-5 p-0">
                    <ol class="validate-ol f-s-12">
                        <li>1、资源名称，必填；</li>
                        <li>2、资源图标，非必填；</li>
                        <li>3、资源URL，非必填；</li>
                        <li>4、资源类型，必选；</li>
                        <li>5、权限代码，必填；</li>
                        <li>6、选择父资源，必选。</li>
                    </ol>
                </div>
            </div>

            <div class="col-xs-12">
                <div id="validate_container" class="display-none alert alert-danger m-0 m-t-5 p-0">
                    <ul class="validate-ul f-s-12"></ul>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>